<?

/** dzUsers - System users form routines
 *
 *  This code is licensed under GPL2.
 *  See LICENSE or www.gnu.org for more details.
 *
 *  @author Jyry Kuukkanen
 *  $Id: dzusers.php,v 1.1 2005/03/12 16:21:39 jyry Exp $
 */

/* Include files needed */
include_once("sodebug.php");
include_once("sostring.php");
include_once("soarrayset.php");

include_once("dzgeneric.php");
include_once("dzpoke.php");
include_once("dzitu.php");
include_once("dzconst.php");
include_once("dzlogin.php");
include_once("dzmanager.php");
include_once("dzsession.php");
include_once("dzrpc.php");


/** Pre in-filter routine
 *  Processes form data before passing it to input filtering.
 *  @param object soArraySet $Params Form data.
 *  @return bool True on success or false on error.
 */
function preInFilter($Params) {
    if (!($htpasswd = dzGetIniItem(DZIS_GENERAL, DZID_HTPASSWD, "app"))) {
        return NULL;
    }; // if

    $passwdfile = dzGetIniItem(DZIS_GENERAL, DZID_PASSWDFILE, "app");
    (file_exists($passwdfile)) ? $create = "" : $create = "-c";

    $id = $Params->getArrayItem("dzusers.id", 0);
    $passwd = $Params->getArrayItem("dzusers.password", 0);
    
    $result = exec($htpasswd." -b ".$create." ".
                   $passwdfile." ".$id." ".$passwd);
#    echo($htpasswd." -b ".$create." ".
#                   $passwdfile." ".$id." ".$passwd."<br>");

#    var_dump($Params);
#    echo"res=$result<br>";

    return $result;
}; // preInFilter

?>
